{%- assign entry = include.entry %}
{%- assign folder_entry_class = include.folder_entry_class %}
{%- assign item_entry_class = include.item_entry_class %}

{%- if entry.hot == true %}
    {%- assign item_entry_class = item_entry_class | append: ' sidebar__item_hot' %}
{%- endif %}

{% assign entry_with_lang = entry.url | prepend: page.lang | prepend: "/" %}
{%- if entry.folders %}
<li class="{{ folder_entry_class }}">
    <a href="#">{%- if entry.title[page.lang] %}{{ entry.title[page.lang] }}{% else %}{{ entry.title }}{% endif -%}</a>
    <ul class="sidebar__submenu">
        {%- for entry in entry.folders %}
        {% include sidebar_entry.html entry=entry folder_entry_class="sidebar__submenu-item sidebar__submenu-item_parent" item_entry_class="sidebar__submenu-item" %}
        {%- endfor %}
    </ul>
</li>
{%- elsif entry.external_url %}
<li class="{{ item_entry_class }}"><a href="{{ entry.external_url }}" target="_blank">{%- if entry.title[page.lang] %}{{ entry.title[page.lang] }}{% else %}{{ entry.title }}{% endif -%}</a></li>
{%- elsif page.url == entry.url or page.url == entry_with_lang %}
<li class="{{ item_entry_class }} active"><a href="{{ entry.url | true_relative_url }}">{%- if entry.title[page.lang] %}{{ entry.title[page.lang] }}{% else %}{{ entry.title }}{% endif -%}</a></li>
{%- else %}
    {%- if page.name == '404.md' %}
    <li class="{{ item_entry_class }}"><a data-proofer-ignore href="{{ site.canonical_url_prefix }}{{ entry.url | relative_url }}">{%- if entry.title[page.lang] %}{{ entry.title[page.lang] }}{% else %}{{ entry.title }}{% endif -%}</a></li>
    {% else %}
    <li class="{{ item_entry_class }}"><a href="{{ entry.url | true_relative_url }}">{%- if entry.title[page.lang] %}{{ entry.title[page.lang] }}{% else %}{{ entry.title }}{% endif -%}</a></li>
    {%- endif %}
{%- endif %}